package com.ceair.flight.refund.location.dt.enums;

/**
 * 方法枚举
 * @description 枚举项的命名规则为类名+方法，如果还不能区分加上包名
 * @author Chenglongyi
 */
public enum MethodEnum {
    REFUND_APPLY(1, "退票申请计算手续费"),
    CALCULATE_FEE(2, "查询退票手续费");

    /**
     * 简码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String description;

    private MethodEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * @return Returns the code.
     */
    public Integer getCode() {
        return code;
    }

    /**
     * @return Returns the description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * 通过枚举<code>code</code>获得枚举。
     *
     * @param code 简码
     * @return 枚举
     */
    public static MethodEnum getByCode(Integer code) {
        for (MethodEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
